package com.thunisoft.netty.custom;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @title NettyCustomclientInitializer.java
 * @package com.thunisoft.netty.custom
 * @projectName spring.boot
 * @author yzj 
 * @date 2019年10月8日 下午6:10:15
 */
public class NettyCustomClientInitializer extends ChannelInitializer<SocketChannel>{
	
	private static final CustomEncoder ENCODER2 = new CustomEncoder();
	
	@Override
	protected void initChannel(SocketChannel socketChannel) throws Exception {
		  ChannelPipeline pipeline = socketChannel.pipeline();
    	  
          pipeline.addLast(ENCODER2);
          pipeline.addLast(new CustomDecoder());
          // 添加逻辑控制层
          pipeline.addLast(new NettyCustomClientHandler());
	}


}
